<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>有奖答题平台</title>
    <!-- ICON -->
    <link href="/frame/images/meatball.ico" type="image/ico" rel="shortcut icon">
    <!-- CSS -->
    <link rel="stylesheet" href="/lib/layuiadmin/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/lib/layuiadmin/css/admin.css" media="all">
    <link rel="stylesheet" href="/lib/layuiadmin/css/login.css" media="all">
    <link rel="stylesheet" href="/lib/nprogress/nprogress.css" media="all">
    <link rel="stylesheet" href="/login1/css/styles.css" media="all">
</head>
<body>
<div class="htmleaf-container">
    <div class="wrapper">
        <div class="container">
            <h1>有奖答题平台</h1>

<!--            <form class="form">-->
<!--                <input type="text" placeholder="Username">-->
<!--                <input type="password" placeholder="Password">-->
<!--                <button type="submit" id="login-button">Login</button>-->
<!--            </form>-->
            <div id="LAY-user-login" style="display: none;">
                <div class="layadmin-user-login-main">
                    <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username" style="z-index:2"></label>
                            <input type="text" name="account" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password" style="z-index:2"></label>
                            <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                        </div>

                        <div class="layui-form-item" style="margin-bottom: 20px;">
                            <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                        </div>
                        <div class="layui-form-item">
                            <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登入后台</button>
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <ul class="bg-bubbles">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
</div>

<script src="/login1/js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
    $('#login-button').click(function (event) {
        event.preventDefault();
        $('form').fadeOut(500);
        $('.wrapper').addClass('form-success');
    });
</script>

<!--<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';color:#000000">-->
<!--    <h1>有奖答题平台</h1>-->
<!--</div>-->
<!--<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">-->

<!--    <div class="layadmin-user-login-main">-->
<!--        <div class="layadmin-user-login-box layadmin-user-login-header">-->
<!--            <h2>有奖答题平台</h2>-->
<!--        </div>-->
<!--        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layadmin-user-login-icon layui-icon layui-icon-username"-->
<!--                       for="LAY-user-login-username"></label>-->
<!--                <input type="text" name="account" id="LAY-user-login-username" lay-verify="required" placeholder="用户名"-->
<!--                       class="layui-input">-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label class="layadmin-user-login-icon layui-icon layui-icon-password"-->
<!--                       for="LAY-user-login-password"></label>-->
<!--                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required"-->
<!--                       placeholder="密码" class="layui-input">-->
<!--            </div>-->

<!--            <div class="layui-form-item" style="margin-bottom: 20px;">-->
<!--                <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登入后台</button>-->
<!--            </div>-->

<!--        </div>-->
<!--    </div>-->

<!--</div>-->

<script type="text/javascript" src="/lib/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/lib/nprogress/nprogress.js"></script>
<script>
layui.config({
    base: '/lib/layuiadmin/' //静态资源所在路径
}).extend({
    index: 'lib/index' //主入口模块
}).use('index', function() {
    var $ = layui.jquery,
        form = layui.form;

    form.render();
    //提交
    form.on('submit(LAY-user-login-submit)', function (obj) {
        NProgress.start();
        //请求登入接口
        $.ajax({
            url: '/validate',
            type: 'POST',
            data: obj.field,
            dataType: 'json',
            success: function (res) {
                console.log(res.code);
                if(res.code != 10000) {
                    layer.msg(res.message, {icon: 5});
//					return false;
                } else {
                    // window.location.href = '/';
                    window.location.replace("/");
//					return true;
                }
                NProgress.done();
            }
        });
        return false;
    });

});
</script>
</body>
</html>